import React, { Component } from 'react';
import Item from './Item'
import './list.css'

class List extends Component {

  state = {
    title:{
      0: '待做任务',
      1: '完成任务',
    }
  }
  render() {
    let { type, List } = this.props
    let { title }=this.state
    return (
        <div className='list'>
          <div className='title'>
          <h4>{ title[type] }</h4>
          <span>{ List.length }</span>
          </div>
        <ul>
          {
            List.map(el => {
              return <Item key={el.id} data={el}></Item>
            })
          }
            
          </ul>
        </div>
      
    );
  }
}

export default List;